package view;

import java.io.File;
import javax.swing.JFileChooser;

import main.KeyDefinitions;

/**
 *
 * @author Kyle
 */
public class FileSave extends JFileChooser{
    KeyDefinitions keyDefs;
    public FileSave(KeyDefinitions _keyDefs,EditControlView ecv){
        keyDefs = _keyDefs;
        int option = this.showSaveDialog(this);
        if(option == JFileChooser.APPROVE_OPTION){
            File file = this.getSelectedFile();
            keyDefs.saveKeyDefinitions(file);
            ecv.updateButtonText();
        }
        else{
            this.getParent().remove(this);
        }
    }
}
